<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.6 -->
  <link rel="stylesheet" href="/static/adminlte/bootstrap/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="/static/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" type="text/css" href="/static/css/ionicons.min.css" />
  <link rel="stylesheet" href="/static/bootstrap-datetimepicker-master/css/bootstrap-datetimepicker.min.css">  
  <!-- Theme style -->
  <link rel="stylesheet" href="/static/adminlte/dist/css/AdminLTE.min.css">
		<title></title>
	</head>
	<body>

<section class="content-header">
      <h1>订单列表<small>Order list</small></h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> 后台管理</a></li>
        <li><a href="#">订单管理</a></li>
        <li class="active">订单列表</li>
      </ol>
     
</section>
 <hr /> 
<section class="content">



<div class="row">

	<form action="{{ route('admin.order.index') }}" id="search-form2" class="navbar-form form-inline" method="post">
		<div class="form-group">
			<label class="control-label" for="input-order-id">收货人</label>
			<div class="input-group">
				<input type="text" class="form-control" name="address_username" placeholder="收货人" value="{{ request('address_username') }}"  style="width:100px;">
			</div>
		</div>
		<div class="form-group">
			<label class="control-label" for="input-order-id">订单编号</label>
			<div class="input-group">
				<input type="text" class="form-control" name="order_sn" placeholder="订单编号" value="{{ request('order_sn') }}" style="width:100px;">
			</div>
		</div>
		<div class="form-group">
			<label class="control-label" for="input-date-added">下单日期</label>
			<div class="input-group">
				<input type="text" class="form-control times" name="starttime" value="{{ request('starttime') }}" placeholder="开始时间" >
			</div>
			-
			<div class="input-group">
				<input type="text" class="form-control times" name="endtime" value="{{ request('endtime') }}" placeholder="结束时间" >
			</div>
		</div>
		
		<div class="form-group">
			<select name="pay_status" class="form-control" style="width:100px;">
				<option value="">支付状态</option>
				<option value="0" {{ request('pay_status')==="0" ? 'selected="selected"' : '' }}>未支付</option>
				<option value="1" {{ request('pay_status')==="1" ? 'selected="selected"' : '' }}>已支付</option>
			</select>
		</div>

		<div class="form-group">
			<select name="shipping_status" class="form-control" style="width:100px;">
				<option value="">发货状态</option>
				<option value="1" {{ request('shipping_status')==="1" ? 'selected="selected"' : '' }}>未发货</option>
				<option value="2" {{ request('shipping_status')==="2" ? 'selected="selected"' : '' }}>已发货</option>
			</select>
		</div>
		<div class="form-group">
			<select name="order_status" class="form-control" style="width:100px;">
				<option value="" >订单状态</option>
				<option value="0" {{ request('order_status')==="0" ? 'selected="selected"' : '' }}>待处理</option>
				<option value="1" {{ request('order_status')==="1" ? 'selected="selected"' : '' }}>已处理</option>
				<option value="2" {{ request('order_status')==="2" ? 'selected="selected"' : '' }}>已完成</option>
				<option value="3" {{ request('order_status')==="3" ? 'selected="selected"' : '' }}>已关闭</option>
				<option value="4" {{ request('order_status')==="4" ? 'selected="selected"' : '' }}>申请退款</option>
				<option value="5" {{ request('order_status')==="5" ? 'selected="selected"' : '' }}>退款中</option>
				<option value="5" {{ request('order_status')==="6" ? 'selected="selected"' : '' }}>已退款</option>
			</select>
		</div>
		<div class="form-group">
			<input type="hidden" name="_token" value="{{csrf_token()}}">
			<button type="submit"  class="btn btn-primary"><i class="fa fa-search"></i> 筛选</button>
		</div>
		<div class="form-group">
			<!--<a href="" class="btn btn-primary"><i class="fa fa-search"></i>添加订单</a>-->
		</div>
	</form>
	<hr />
    </div>

		<div class="row">
				<div class="col-xs-12">

					<table class="table table-hover">
						<thead>
							<tr>
								<th class="hidden-xs">
									<input  type="checkbox" value="">
								</th>
								<th>ID</th>
								<th>订单编号</th>
								<th>联系人</th>
								<th>地址</th>
								<th>价格</th>
								<th>支付状态</th>
								<th>发货状态</th>
								<th>时间</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>

							@foreach($order_list as $v)
							<tr>
								<td>
									<input  type="checkbox" value="">
								</td>
								<td>{{ $v->order_id }}</td>
								<td>{{ $v->order_sn }}</td>
								<td>{{ $v->address_username }}</td>
								<td>{{ $v->address_detailinfo }}</td>
								<td>{{ $v->order_amount }}</td>
								<td>{{ ($v->pay_status==1) ? '已支付' : '未支付' }}</td>
								<td> 
									@if($v->shipping_status==1)
										未发货 <a href="{{ route('admin.order.setshippingstatus',['order_id'=>$v->order_id,'status'=>2]) }}" class="label label-danger ajax-a">发货</a> 
									@elseif($v->shipping_status==2)
										已发货 <a href="{{ route('admin.order.setshippingstatus',['order_id'=>$v->order_id,'status'=>3]) }}" class="label label-danger ajax-a">完成</a> 
									@elseif($v->shipping_status==3)
										已完成
									@endif </td>
								<td>{{ $v->created_at }}</td>
								<td> 
									@if($v->order_status==0)
										待处理 
									@elseif($v->order_status==1)
										已处理  <a href="{{ route('admin.order.setorderstatus',['order_id'=>$v->order_id,'status'=>2]) }}" class="label label-success ajax-a">完成</a> 
									@elseif($v->order_status==2)
										完成
									@elseif($v->order_status==3)
										已关闭
									@elseif($v->order_status==4)
										申请退货
									@elseif($v->order_status==5)
										退货中
									@elseif($v->order_status==6)
										已退货
									@endif 
								</td>
							</tr>
							@endforeach
						</tbody>
					</table>

					{{ $order_list->appends([
						'address_username'	=>request('address_username'),
						'order_sn'			=>request('order_sn'),
						'starttime'			=>request('starttime'),
						'endtime'			=>request('endtime'),
						'pay_status'		=>request('pay_status'),
						'shipping_status'	=>request('shipping_status'),
						'order_status'		=>request('order_status')
						])->links() }}

				</div><!--/.row-->

      </div>
  </section>
<!-- jQuery 2.2.3 -->
<script src="/static/adminlte/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="/static/layer/layer.js" type="text/javascript" charset="utf-8"></script>
<!-- Bootstrap 3.3.6 -->
<script src="/static/adminlte/bootstrap/js/bootstrap.min.js"></script>
<script src="/static/bootstrap-datetimepicker-master/js/bootstrap-datetimepicker.min.js"></script>
<script src="/static/bootstrap-datetimepicker-master/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="/static/js/admin.js?123"></script>
<script>
  $(function () {
  	
    //时间选择器 
    $('.times').datetimepicker({
        format: 'yyyy-mm-dd',
        language: 'zh-CN',
        minView: "month", //选择日期后，不会再跳转去选择时分秒
        todayBtn:  1,     //显示今日按钮
    	autoclose: 1,     //选中自动关闭

    });

  });
</script>
	</body>
</html>
